local sk__luanzheng = fk.CreateSkill {

  name = "sk__luanzheng",

  tags = {},

}



sk__luanzheng:addEffect(fk.AfterCardTargetDeclared, {
  name = "sk__luanzheng",
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(sk__luanzheng.name) and (data.card.type == Card.TypeBasic or data.card:isCommonTrick()) and
        #data:getExtraTargets() > 0 and #data.tos == 1 and
        player:usedSkillTimes(sk__luanzheng.name, Player.HistoryTurn) == 0
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local tos = room:askForChoosePlayers(player, table.map(data:getExtraTargets(), Util.IdMapper), 1, 1,
      "#sk__luanzheng-choose:::" .. data.card:toLogString(), sk__luanzheng.name, true)
    if #tos > 0 then
      event:setCostData(self, tos[1])
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    data:addTarget(room:getPlayerById(event:getCostData(self)))
  end,
})

return sk__luanzheng
